<template>

  <div class="about">
    <h1>{{ title }}</h1>
    <h2>这是User页</h2>
 <hr><br>

<span>展示对象：{{ $store.state.user }}</span>
<button @click="modifyUser"> 修改对象属性 </button>



 <hr><br>

    <span>欢迎你！！！ {{$route.params.username}} , {{ msg }}</span>
    <hr><br>

    <span> 展示vuex中的store：{{ $store.state.count }}</span>
    <button @click="updateInfo">store中+数</button>
    <button @click="decre(5)"> - 5 </button>
  </div>
</template>

<script>
import { UPDATE_INFO
,DECREMENT
} from "@/store/mutations";

export default {
  data(){
    return {
      title : 'User',
      msg : '懵逼树上懵逼果，懵逼树下你和我 '
    }
  },
  methods:{
    updateInfo(){
      this.$store.commit(UPDATE_INFO);
    },
    decre(num){
      this.$store.commit(DECREMENT  , num );
    },
    modifyUser(){
      // this.$store.commit('modifyUser' );
      this.$store.dispatch('asyncModifyUser');
    }
  }
}
</script>

<style scoped>

</style>
